<?php
require_once('mysql.php');

$todolist_id = $_GET['todolist_id'];

$json = array();

$query = "SELECT email, id FROM users WHERE id IN (SELECT user_id FROM can_edit WHERE list_id=$todolist_id)";

$result = mysql_query($query) or die($query);

while($row = mysql_fetch_assoc($result)) {
	$entry = array();
	$entry['email'] = $row['email'];
	$entry['id'] = $row['id'];
	array_push($json, $entry);
}

echo json_encode($json);
?>
